import React, {useEffect, useState} from 'react';
import axios from "../../utils/http"

interface Article {
    id: number
    title: string
    content: string
    userId: string
    likeCount: number
}

function Index() {
    const [article, setArticle] = useState<Article[]>([]);

    useEffect(() => {
        axios.get("/article/getList").then((res) => {
            setArticle(res.data.data.list)
        })
    }, []);

    return (
        <>
            <div>
                <div>
                    {
                        article.map((item) => (
                            <div key={item.id}>
                                <div>{item.title}</div>
                            </div>
                        ))
                    }
                </div>
            </div>
        </>
    );
}

export default Index;